From the Firehose

Get slug

const getSlug = (title: string) => {
  const trimStr = title.replace(/^\s+|\s+$|(\s)\s+|\W+/g, "$1");
  const slug = trimStr.toLowerCase().split(" ").join("-");
  return slug;
};

Npm manager

Слугіфікує рядки, навіть якщо вони містять Unicode. https://www.npmjs.com

Category: JavaScript | Comments: 0

Comments: 0

About

Customize this section to tell your visitors a little bit about your publication, writers, content, or something else entirely. Totally up to you.